<div class="loader"></div>
<div class="row filter-form-container">
{{ Form::open(array('url' => $base, 'id' => 'form-filter')) }}
	{{-- Form Filter Fields --}}
	<div class='filter-form-group row'>
		<div class="form-group col-md-4">
			{{ Form::label('filter_username', $text_filter_username) }}
			{{ Form::text('filter_username', Input::get('filter_username'), array('class' => 'form-control')) }}
		</div>
		<div class="form-group col-md-4">
			{{ Form::label('filter_filename', $text_filter_filename) }}
			{{ Form::text('filter_filename', Input::get('filter_filename'), array('class' => 'form-control')) }}
		</div>
		<div class="clearfix"></div>
		<div class="form-group col-md-4">
			<strong>{{ $text_filter_upload_date }}</strong>
			<div class="row" style="padding-top: 5px;">
				<div class='col-md-6'>
					<div class="form-group" style="margin-bottom: 3px;">
						{{ Form::text('filter_uploaded_from', Input::get('filter_uploaded_from'), array('class' => 'form-control', 'placeholder' => $text_filter_upload_from )) }}
					</div>
				</div>
				<div class='col-md-6'>
					<div class="form-group" style="margin-bottom: 3px;">
						{{ Form::text('filter_uploaded_to', Input::get('filter_uploaded_to'), array('class' => 'form-control', 'placeholder' => $text_filter_upload_to)) }}
					</div>
				</div>
			</div>
		</div>	
		<div class="clearfix"></div>
	</div>
	
	{{-- Form Filter Buttons --}}
	<div class="filter-btn-row row">
	{{ HTML::link(URL::to($base), $text_filter, array('class' => 'btn btn-default', 'id'=> 'filter')) }}
	</div>
{{ Form::close() }}
</div>
<p>&nbsp;</p>
<table class="table table-bordered table-striped table-hover">
  <thead>
    <tr>
      <td class="text-left"><a href="#" class="asc">{{ $list_username }}</a></td>
      <td class="text-left"><a href="#" class="asc">{{ $list_created_at }}</a></td>
      <td class="text-left"><a href="#" class="asc">{{ $list_file_uploaded }}</a></td>
    </tr>
  </thead>
  <tbody>
	@foreach($results as $key=>$value)
	<tr>
		<td>{{ $value->username }}</td>
		<td>{{ $value->created_at }}</td>
		<td><a href="{{ URL::to('assets/tmp/' . $value->filename) }}" target="_blank">{{ $value->original_filename }}</td>
	</tr>
	@endforeach            
  </tbody>
</table>

<div class="box-footer">
	<div class="col-xs-14 text-center">
		<div class="dataTables_info">Showing {{ $results->getFrom() }} to {{ $results->getTo() }} of {{ $results->getTotal() }} entries</div>
	</div>
	<div class="col-xs-14 text-center">
		<div class="no-margin">
		{{ $results->appends(Input::all())->links() }}
		</div>
	</div>
</div>

<script type="text/javascript">
$(function(){
	// Add formatted for Date fields
	var dt = new Date();
	var date_elems = ['input[name="filter_uploaded_to"]', 'input[name="filter_uploaded_from"]'];
	formatDatePickers(date_elems, 'MM/DD/YYYY', (dt.getMonth() + 1) + '/' + dt.getDate() + '/' + dt.getFullYear() );
});

/**
 * Format Date Fields.
 * @author AngelaMisa 02/18/2015
 * @param elems, format, max_date
 * @return void
 */
function formatDatePickers( elems, format, max_date ) {
	for ( var i = 0; i <= elems.length; i++ ) {
		$(elems[i]).datetimepicker({
			format: format,
			maxDate: max_date
		});
	}
}
</script>